package com.dude.screens;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.dude.R;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

/* this activity shows the user the help manual 
 */
public class HelpScreen extends Activity{
	
	protected TextView helpText;

	public void onCreate(Bundle savedInstanceState) {   
        super.onCreate(savedInstanceState);
        setContentView(R.layout.help_layout); 
        helpText = (TextView)findViewById(R.id.help_text_id);	
        helpText.setText(readHelpTextFile());
	}
	
	
	protected String readHelpTextFile()
    {
		
		InputStream inputStream = HelpScreen.this.getResources().openRawResource(R.raw.help_text);
        InputStreamReader inputreader = new InputStreamReader(inputStream);
        BufferedReader buffreader = new BufferedReader(inputreader);
        String line;
        StringBuilder text = new StringBuilder();
        try {
        	while (( line = buffreader.readLine()) != null) {
        		text.append(line);
                text.append('\n');
            }
        } catch (IOException e) {
               return null;
        }
        return text.toString();
    }


}
